package cn.jcet.mapreduce.index;

import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;

import java.io.IOException;

/**
 * @author 鲜磊
 * @Date 2021/1/2 23:05
 */
public class IndexTwoReduce extends Reducer<Text,Text,Text,Text> {

    private Text v = new Text();

    @Override
    protected void reduce(Text key, Iterable<Text> values, Context context) throws IOException, InterruptedException {

        StringBuilder sb = new StringBuilder();

        for (Text value : values) {
            sb.append(value.toString().replace("--","-->")+"\t");
        }

        v.set(sb.toString());

        context.write(key,v);
    }
}
